package com.example.codegenerator.common.config;

import lombok.Data;

/**
 * 模板配置对象
 *
 * @author Lv
 * @date 2023/9/9
 */
@Data
public class TemplateConfig {
    /**
     * entity 模板路径
     */
    private String entity = "/templates/entity.java";

    /**
     * mapper xml 模板路径
     */
    private String mapperXml = "/templates/mapper.xml";

    /**
     * mapper 模板路径
     */
    private String mapper = "/templates/mapper.java";

    /**
     * service 模板路径
     */
    private String service = "/templates/service.java";

    /**
     * serviceImpl 模板路径
     */
    private String serviceImpl = "/templates/serviceImpl.java";

    /**
     * controller 模板路径
     */
    private String controller = "/templates/controller.java";

    /**
     * controllerApi 模板路径
     */
    private String controllerApi = "/templates/controllerApi.java";

    /**
     * provider 模板路径
     */
    private String provider = "/templates/provider.java";

    /**
     * providerImpl 模板路径
     */
    private String providerImpl = "/templates/providerImpl.java";

    /**
     * facade 模板路径
     */
    private String facade = "/templates/facade.java";

    /**
     * vo 模板路径
     */
    private String vo = "/templates/vo.java";

    /**
     * bo 模板路径
     */
    private String bo = "/templates/bo.java";

    /**
     * dto 模板路径
     */
    private String dto = "/templates/dto.java";

    /**
     * vue 模板路径
     */
    private String vue = "/templates/vue.vue";

    /**
     * js 模板路径
     */
    private String js = "/templates/js.js";

    /**
     * 初始化模板对象
     */
    public static TemplateConfig templateConfig;

    /**
     * 单例模式获取模板对象实例 （懒汉式）
     *
     * @return
     */
    public static TemplateConfig getInstance() {
        if (templateConfig == null) {
            synchronized (TemplateConfig.class) {
                if (templateConfig == null) {
                    templateConfig = new TemplateConfig();
                }
            }
        }
        return templateConfig;
    }
}
